package com.atwisdom.star.common.tree;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @Date: 2023-04-20 13:07
 */
@Data
public class TreeNode<T> {
    private String id;
    private T data;
    private TreeNode<T> parent;
    private List<TreeNode<T>> children = new ArrayList<>();

    public TreeNode(String id, TreeNode parent) {
        this.id = id;
        this.parent = parent;
        this.data = data;
    }

    public TreeNode(String id, TreeNode parent, T data) {
        this.id = id;
        this.parent = parent;
        this.data = data;
    }

    public void addChild(TreeNode child) {
        children.add(child);
    }
}
